﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S_Gridding.Api.Application.Commands.Respon;
using S_Gridding.Api.Application.Commands.Teamgrid;

namespace S_Gridding.Api.Controllers
{
    /// <summary>
    /// 网格队伍管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TeamgridController : ControllerBase
    {
        private readonly IMediator _mediator;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="mediator"></param>
        public TeamgridController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        ///网格队伍新增
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> TeamgrCreate(TeamgridCreateCommands command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        ///网格队伍删除
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<int> TeamgrDel([FromQuery] TeamgridDelCommands command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        ///责任网格修改
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<int> TeamgrUpd(TeamgridUpdCommands command)
        {
            return await _mediator.Send(command);
        }
    }
}
